#ssh-agent /bin/bash
#ssh-add ~/.ssh/id_rsa 
export HASTHI_HOME=`pwd`
cd $HASTHI_HOME

#SERVICE_COUNTS="200 400 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000"
#MANGER_COUNTS="2,1000 6,5000 11,6000 21,8000 51,15000"
#MANGER_COUNTS="10,10000 10,15000 10,20000 20,10000 20,15000 20,20000 40,10000 40,15000 60,10000"
#SERVICE_COUNTS="15000 10000"
#MANGER_COUNTS="10,20000 20 45 50,10100"
SERVICE_COUNTS="10000"
MANGER_COUNTS="10,21000"

for md in ${MANGER_COUNTS}; do
	for sc in ${SERVICE_COUNTS}; do
		mc=`echo $md|cut -f1 -d','`
		maxsc=`echo $md|cut -f2 -d','`
		
		$HASTHI_HOME/bootstrap.sh reset
		sleep 1s
		if [ "$sc" -le $maxsc ]; then
			LOG_DIR=/u/hperera/logs/hasthi_${sc}X${mc}_`date +%m_%d_%H_%M`
			echo $LOG_DIR
			mkdir $LOG_DIR
			cmd1="srun -N $(($sc/200)) serviceset.sh 200 $LOG_DIR"
			cmd2="srun -N ${mc} testMngeNode.sh $HASTHI_HOME/hasthi.properties $HASTHI_HOME $LOG_DIR"
			echo $cmd1 $cmd2
			$cmd2 &
			sleep 40s
			$cmd1
			#Following wait for all child processes to complete 
			wait 
			echo $mc $sc "<" $maxsc " Done"
			mv hasthi*.log $LOG_DIR
			mkdir $LOG_DIR/tmp
			mv hasthi_job_* $LOG_DIR/tmp
			mv service*.log $LOG_DIR/tmp
		else	
			echo $mc $sc "<" $maxsc " Ignored"
		fi			
	done
done 

